<template>
  <a-modal :open="open" width="500px" title="角色维护" centered :keyboard="false" @ok="onOk" @cancel="onCancel">
    <!-- :rules="[{ required: true, message: '请输入床位号' }]" -->
    <a-form :model="formState" :colon="false">
      <a-form-item label="角色名称" class="w-full">
        <a-input v-model:value="formState.brName" placeholder="请输入" />
      </a-form-item>
      <a-form-item label="顺序号" class="w-full">
        <a-input v-model:value="formState.sxh" placeholder="请输入" />
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script setup>
import { ref, watch } from 'vue'

const props = defineProps({
  open: {
    type: Boolean,
    default: false
  }
})
const emit = defineEmits(['update:open', 'success'])
const formState = ref({})

const onOk = () => {
  emit('success')
}
const onCancel = () => {
  emit('update:open', false)
}
watch(
  () => props.value,
  (val) => {
    formState.value = val
  },
  {
    immediate: true
  }
)
</script>
<style lang="less" scoped>
.ant-form {
  display: flex;
  flex-flow: row wrap;
  min-width: 0;
  :deep(.ant-form-item) {
    .ant-form-item-label {
      width: 90px;
    }
  }
  .ant-picker {
    width: 100%;
  }
}
</style>
